ifeq ($(strip $(targetbase)),linux)
ifeq ($(strip $(LINUX_LK)),TRUE)

include $(SDK_DIR)/mk/sys_km.mk
# usw
ifneq ($(ASW_ALONE), yes)
SDK_CLI_SRCS := $(shell find $(SDK_DIR)/ctccli -maxdepth 1 -name "*.c")
SDK_CLI_SRCS += $(shell find $(SDK_DIR)/ctccli/sdkcli -maxdepth 1 -name "*.c")

ifeq ($(USW),yes)
SDK_CLI_SRCS += $(shell find $(SDK_DIR)/ctccli/sdkcli/usw -name "*.c")
endif
SDK_CLI_SRCS += $(foreach n, $(COMPATIBAL_CHIP), $(shell find $(SDK_DIR)/ctccli/sdkcli/$(n) -name "*.c"))
endif
ifeq ($(ASW),yes)
SDK_CLI_SRCS += $(shell find $(SDK_DIR)/ctccli/sdkcli/asw -name "*.c")
endif

SDK_CLI_OBJS = $(patsubst %.c,%.o,$(SDK_CLI_SRCS))
SDK_CLI_OBJS := $(subst $(SDK_DIR)/ctccli/,,$(SDK_CLI_OBJS))


lib-m += $(SDK_CLI_OBJS)

else
include $(MK_DIR)/sys.mk
OBJ_DIR=$(OBJ_BASE_DIR)/ctccli
LIB = ctccli
ifneq ($(ASW_ALONE), yes)
SRCS = $(wildcard *.c)
SRCS += $(shell find sdkcli -maxdepth 1 -name "*.c")
SRCS += $(foreach n, $(COMPATIBAL_CHIP), $(shell find sdkcli/$(n)/ -name "*.c"))
endif
ifeq ($(ASW),yes)
SRCS += $(shell find sdkcli/asw -name "*.c")
endif
ifeq ($(UNIT_TEST),TRUE)
CPPFLAGS += -DSDK_UNIT_TEST
endif

CPPFLAGS += -I$(SDK_DIR)/dal/include
CPPFLAGS += -I$(SDK_DIR)/sal/include
CPPFLAGS += -I$(SDK_DIR)/core/api/include
CPPFLAGS += -I$(SDK_DIR)/core/common/include
CPPFLAGS += -I$(SDK_DIR)/core/app
CPPFLAGS += -I$(SDK_DIR)/core
CPPFLAGS += $(foreach n, $(COMPATIBAL_CHIP), -I$(SDK_DIR)/core/$(n)/include)
CPPFLAGS += $(foreach n, $(COMPATIBAL_CHIP), -I$(SDK_DIR)/core/$(n)/include/ctc)
CPPFLAGS += $(foreach n, $(COMPATIBAL_CHIP), -I$(SDK_DIR)/core/$(n)/include/sys)
CPPFLAGS += -I$(SDK_DIR)/libctccli/include
CPPFLAGS += -I$(SDK_DIR)/driver
CPPFLAGS += -I$(SDK_DIR)/sample
CPPFLAGS += $(foreach n, $(COMPATIBAL_CHIP), -I$(SDK_DIR)/ctccli/sdkcli/$(n))
CPPFLAGS += -I$(SDK_DIR)/ctccli/sdkcli/sample
CPPFLAGS += -I$(SDK_DIR)/ctccli/sdkcli/
CPPFLAGS += -I$(SDK_DIR)/dkits
CPPFLAGS += -I$(SDK_DIR)/libctccli/ctc_shell/include
CPPFLAGS += -I$(SDK_DIR)/libpktxr/include
ifeq ($(CTC_PHY_EN), yes)
CPPFLAGS += -I$(SDK_DIR)/phy_drv/include
CPPFLAGS += -I$(SDK_DIR)/app/config
endif


ifeq ($(USW),yes)
CPPFLAGS += -I$(SDK_DIR)/driver/api
CPPFLAGS += -I$(SDK_DIR)/core/usw/include
CPPFLAGS += -I$(SDK_DIR)/core/usw/include/ctc_tmx
CPPFLAGS += -I$(SDK_DIR)/core/usw/include/ctc_at
CPPFLAGS += -I$(SDK_DIR)/core/usw/include/sys
SRCS += $(shell find sdkcli/usw/ -name "*.c")
endif

ifeq ($(ASW),yes)
CPPFLAGS += -I$(SDK_DIR)/driver
CPPFLAGS += -I$(SDK_DIR)/core/asw/include/
endif
include $(MK_DIR)/lib.mk

endif
endif


################################## vxworks #####################################
ifeq ($(strip $(targetbase)),vxworks)
include $(MK_DIR)/sys_vx.mk
OBJ_DIR=$(OBJ_BASE_DIR)/ctccli

all_targets = master sdkcli libctccli

all: $(all_targets) FORCE
clean: $(addprefix clean_,$(all_targets)) FORCE

master: FORCE
	$(CTC_MAKE) -f Makefile.vx

clean_master: FORCE
	$(CTC_MAKE) -f Makefile.vx clean

sdkcli: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/ctccli/sdkcli -f Makefile_sdkcli.vx

clean_sdkcli: FORCE
	$(CTC_MAKE) -C $(SDK_DIR)/ctccli/sdkcli -f Makefile_sdkcli.vx clean

libctccli: FORCE
	$(CTC_MAKE) -f Makefile_libctccli.vx

clean_libctccli: FORCE
	$(CTC_MAKE) -f Makefile_libctccli.vx clean
	
.PHONY: FORCE
FORCE:
endif
